import { createRouter, createWebHistory } from 'vue-router'
import { constantRoute } from './routes'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: constantRoute,
  scrollBehavior() {
    return {
      top: 0,
      left: 0,
    }
  }
})

// router.beforeEach((to, from, next) => {
//   let token = localStorage.getItem('AccessToken')
//   if (to.path === '/login' || to.path === '/guide_page') {
//     next()
//   } else {
//     if (token) {
//       next()
//     } else {
//       next('/login')
//     }
//   }
// })

export default router
